//
//  BannerCell.m
//  Learn
//
//  Created by cjg.mini on 2024/3/29.
//  Copyright © 2024 迟建国. All rights reserved.
//

#import "BannerCell.h"

@implementation BannerCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self setupUI];
        [self setSelectionStyle:(UITableViewCellSelectionStyleNone)];
    }
    
    return self;
    
}

- (void)setupUI {
    //轮播
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(10, 0, SCREEN_W-20, (SCREEN_W-20)*138/355) delegate:nil placeholderImage:[UIImage imageNamed:@""]];
    cycleScrollView.layer.cornerRadius = 15;
    cycleScrollView.layer.masksToBounds = YES;
    cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    cycleScrollView.currentPageDotColor = rgb(170, 149, 95); // 自定义分页控件小圆标颜色
    cycleScrollView.pageDotColor = rgb(233, 226, 207);
    cycleScrollView.pageControlBottomOffset = 40;
    cycleScrollView.autoNomarlStyle = YES;
    [self.contentView addSubview:cycleScrollView];
    self.cycleScrollView = cycleScrollView;

    WS(WeakSelf)
     self.cycleScrollView.clickItemOperationBlock = ^(NSInteger index) {
     NSLog(@">>>>>  %ld", (long)index);
         if(WeakSelf.selectIndexBlock){
             WeakSelf.selectIndexBlock(index);
         }
     };

}

-(void)setImagesURLStrings:(NSArray *)imagesURLStrings {
    _imagesURLStrings=imagesURLStrings;
    self.cycleScrollView.imageURLStringsGroup = imagesURLStrings;
}


@end
